﻿<%@ Page Title="" Language="C#" MasterPageFile="~/View/Master.Master" AutoEventWireup="true" CodeBehind="RaisePurchaseOrder.aspx.cs" Inherits="PresentationLayer.View.WebForm1" %>

<%@ Register src="../mainMenu.ascx" tagname="mainMenu" tagprefix="uc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    </asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
   
    &nbsp;&nbsp;&nbsp;
    <table width="100%">
    <tr>
        <td style="height:auto;width:200px;vertical-align:top;">
           
            <uc1:mainMenu ID="mainMenu1" runat="server" />
           
        </td>
        <td>
         <asp:Panel ID="addOrderList" runat="server" Visible="False">
                    <table width="100%">
                        <tr>
                            <td>
                                <div>
                                   
                                        <h4><u>Purchase Order Forms</u></h4>
                                   
                                    <br />
                                    <table style="height: 91px; width: 357px" >                                      
                                        <tr>
                                            <td >
                                                <asp:Label ID="Label5" runat="server" Text="Item Code"></asp:Label>
                                                &nbsp;</td>
                                            <td>
                                                <asp:Label ID="lblItemCode" runat="server"></asp:Label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td >
                                                <asp:Label ID="Label2" runat="server" Text="Item Name"></asp:Label>
                                            </td>
                                            <td >
                                                <asp:Label ID="lblItemName" runat="server"></asp:Label>
                                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;</td>
                                        </tr>
                                        <tr>
                                            <td >
                                                <asp:Label ID="Label3" runat="server" 
                                Text="Current Stock"></asp:Label>
                                            </td>
                                            <td >
                                                <asp:Label ID="lblCurrentStock" runat="server"></asp:Label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td >
                                                <asp:Label ID="Label4" runat="server" 
                                Text="Reorder Qty."></asp:Label>
                                            </td>
                                            <td >
                                                <asp:Label ID="lblReorderQty" runat="server"></asp:Label>
                                            </td>
                                        </tr>
                                    </table>
                                    <br />
                                    <table>
                                    <tr><td> &nbsp;</td> <td >
                                               <asp:Label ID="err" runat="server"></asp:Label></td></tr>
                                        <tr>
                                            <td >
                                                &nbsp;</td>
                                            <td>
                                                <asp:GridView ID="foo0" runat="server" 
                                autogeneratecolumns="False" CellPadding="4" DataKeyNames="Price" 
                                ForeColor="#333333" GridLines="None" style="margin-left: 0px" Width="439px" Height="89px">
                                                    <AlternatingRowStyle BackColor="White" 
                                    ForeColor="#284775" />
                                                    <columns>
                                                        <asp:boundfield datafield="SupplierId" 
                                        HeaderText="Supplier">
                                                        <ItemStyle HorizontalAlign="Right" />
                                                        </asp:boundfield>
                                                        <asp:boundfield datafield="Price" HeaderText="Price">
                                                        <ItemStyle HorizontalAlign="Right" />
                                                        </asp:boundfield>
                                                        <asp:TemplateField HeaderText="Quantity">
                                                            <ItemTemplate>
                                                                <asp:TextBox ID="qty" runat="server" AutoPostBack="true" 
                                                OnTextChanged="qtyText_Changed" Height="18px" Width="62px" CausesValidation="True" 
                                                                    MaxLength="3"></asp:TextBox>
                                                                &nbsp;
                                                                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                                                                    ControlToValidate="qty" ErrorMessage="Invalid Quantity" ForeColor="Red" 
                                                                    ValidationExpression="^[1-9]+\d*$"></asp:RegularExpressionValidator>
                                                            </ItemTemplate>
                                                            <ItemStyle HorizontalAlign="Right" />
                                                        </asp:TemplateField>
                                                        <asp:TemplateField HeaderText="Amount">
                                                            <ItemTemplate>
                                                                <asp:Label ID="Amount" runat="server"></asp:Label>
                                                            </ItemTemplate>
                                                        </asp:TemplateField>
                                                    </columns>
                                                    <EditRowStyle BackColor="#999999" />
                                                    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" 
                                    ForeColor="White" />
                                                    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" 
                                    ForeColor="White" />
                                                    <PagerStyle BackColor="#284775" ForeColor="White" 
                                    HorizontalAlign="Center" />
                                                    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                                    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" 
                                    ForeColor="#333333" />
                                                </asp:GridView>
                                            </td>
                                        </tr>
                                    </table>
                                    <br />
                                    <table>
                                        <tr>                                   
                                            
                                            <td>
                                                &nbsp;&nbsp;<asp:Button ID="btnOrder" runat="server" 
                                Enabled="False" onclick="btnOrder_Click" Text="Order" Width="98px" />
                                            </td>
                                            <td>
                                                &nbsp;&nbsp;</td>
                                            <td>
                                                &nbsp;&nbsp;</td>
                                            <td>                                                
                                                <asp:Button ID="Cancel" runat="server" Text="Cancel" onclick="Cancel_Click" />
                                            </td>
                                            <td>
                                                &nbsp; &nbsp;&nbsp;</td>
                                        </tr>
                                        <asp:HiddenField ID="tot" runat="server" Value="First" />
                                       
                                    </table>
                                </div>
                            </td>
                        </tr>
                    </table>
                </asp:Panel>

            <div>
        <center>
            <b>
            <h2>
                <u>Raise Purchase Order</u></h2>
            </b>
        </center>
        <br />
        <table>
            <tr>
                <td>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    &nbsp;&nbsp;&nbsp;&nbsp;<asp:Label ID="Label1" runat="server" 
                        Text="Stationery Items below the Reorder level:"></asp:Label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;</td>
                <td>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
                        <td>
                    &nbsp;<asp:Button ID="btnGPurchaseOrder" runat="server" 
                        onclick="btnGPurchaseOrder_Click1" Text="Go To Purchase Order" />
                </td> <td ></td>
            </tr>
        </table>
        <br/> 
        <table>
            <tr>
                <td>             
                    <asp:GridView ID="foo" runat="server" autogeneratecolumns="False" 
                        CellPadding="4" ForeColor="#333333" 
                        GridLines="None" style="margin-left: 0px" Width="648px" 
                        onrowcommand="foo_RowCommand" DataKeyNames="ReorderQty" AllowPaging="True" 
                        PageSize="7" onpageindexchanging="foo_PageIndexChanging" onrowdatabound="foo_RowDataBound"
                        >
                        <AlternatingRowStyle BackColor="White" />
                        <columns>
                        <asp:TemplateField HeaderText="Sr.No">
                                <ItemTemplate>
                                    <%# Container.DataItemIndex + 1 %>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center" />
                            </asp:TemplateField>
                            <asp:boundfield datafield="ItemId" HeaderText="Item Code" />
                            <asp:boundfield datafield="Description" HeaderText="Item Name" >
                            <ItemStyle HorizontalAlign="Center" />
                            </asp:boundfield>
                            <asp:boundfield datafield="ReorderLevel" HeaderText="Reorder Level" >
                            <ItemStyle HorizontalAlign="Center" />
                            </asp:boundfield>
                            <asp:boundfield datafield="ReorderQty" HeaderText="Reorder Qty." >
                            <ItemStyle HorizontalAlign="Center" />
                            </asp:boundfield>
                            <asp:boundfield datafield="TotalQty" HeaderText="Current Stock" >
                            <ItemStyle HorizontalAlign="Center" />
                            </asp:boundfield>
                            <asp:TemplateField><ItemTemplate>
                                <asp:LinkButton ID="Purchase"  CommandName="Purchase" 
                                    CommandArgument='<%# Eval("ItemId") %>' runat="server">Purchase</asp:LinkButton>
                            </ItemTemplate></asp:TemplateField>                              
                        </columns>
                        <EditRowStyle BackColor="#2461BF" />
                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                        <RowStyle BackColor="#EFF3FB" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <SortedAscendingCellStyle BackColor="#F5F7FB" />
                        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                        <SortedDescendingCellStyle BackColor="#E9EBEF" />
                        <SortedDescendingHeaderStyle BackColor="#4870BE" />
                    </asp:GridView>                    
                </td>
                <td>                  
                    </td>
                <td>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
                <td>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                </td>
            </tr>
        </table>

        <br />
        <table>
            <tr>
                <td>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                    &nbsp;</td>
                <td>
                    &nbsp;&nbsp;</td>
                <td>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<asp:Label ID="lblNull"  Visible="False" runat="server" 
                        Text="There is no item to order!" Font-Bold="True" Font-Size="Large" 
                        ForeColor="Red"></asp:Label></td>
                <td>
                    &nbsp;&nbsp;</td>
            </tr>
        </table>
    </div>
       </td> </tr></table>
</asp:Content>
